﻿function Content(newData) {
    this.id = ko.observable(newData.id);
    this.Url = ko.observable(newData.Url);
    this.Comment = ko.observable(newData.Comment);
    this.Data = ko.observable(newData.Date);
    this.UserName = ko.observable(newData.UserName);
    this.Inappropriates = ko.observable(newData.Inappropriates);
    this.UserInapp = ko.observable(newData.UserInapp);
}

function GoodsViewModel() {
    var self = this;

    // Data
    self.goodId = ko.observable(goodId);
    self.newUrlText = ko.observable();
    self.newCommentText = ko.observable();
    //self.gHub = $.connection.goodsHub;

    //AddContent(int goodId, string url, string comment, System.TimeSpan date, int userId)

    // Operations
    self.addContent = function () {
        //self.gHub.server.addContent(self.goodId(), self.newUrlText(), self.newCommentText());
    }

    //self.gHub.client.ConfirmAddContent = function () {
    //    location.reload();
    //}

    //self.fsHub.client.confirmAddFriendSite = function (fsId) {
    //    self.friendSites.push(new FriendSite({ id: fsId, Name: self.newNameText(), Url: self.newUrlText(), SiteId: data.SiteId }));
    //    self.newNameText("");
    //    self.newUrlText("");
    //}

    //self.editFriendSite = function (fs) {
    //    self.fsHub.server.editFriendSite(fs.id, fs.Name, fs.Url);
    //}

    //self.removeFriendSite = function (fs) {
    //    self.fsHub.server.deleteFriendSite(fs.id).done(function () {
    //        self.friendSites.destroy(fs);
    //    });
    //};
};

var gVM = new GoodsViewModel();
ko.applyBindings(gVM);

//$.connection.hub.start();
